package a.a;

import a.c.ab;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.i;
import a.c.j;
import a.c.k;
import a.c.n;
import a.c.q;
import a.c.w;
import a.c.*;
import a.i.a.h;
import a.i.db;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

class mb
{
  static final int a = 0;
  static final int b = 1;
  static final int c = 2;
  static final int d = 3;
  private final a e;
  private int f;
  private u g;
  private int h;
  private int j;
  private int k;
  private boolean l;
  private double m;
  private boolean n;
  
  static void a(a.c.y paramy, j paramj, k paramk)
  {
    int i = m.b;
    boolean bool = m.a;
    paramy.h();
    do
    {
      while (!bool)
      {
        if (!paramy.e()) {
          break;
        }
        paramj.a(paramy.j(), paramj.getDouble(paramy.j()) + paramk.getDouble(paramy.j()));
        paramy.f();
      }
    } while (i != 0);
  }
  
  static void b(a.c.y paramy, j paramj, k paramk)
  {
    int i = m.b;
    boolean bool = m.a;
    paramy.h();
    do
    {
      while (!bool)
      {
        if (!paramy.e()) {
          break;
        }
        paramj.a(paramy.j(), paramj.getDouble(paramy.j()) - paramk.getDouble(paramy.j()));
        paramy.f();
      }
    } while (i != 0);
  }
  
  static void a(a.c.y paramy, k paramk, i parami)
  {
    int i = m.b;
    boolean bool = m.a;
    paramy.h();
    do
    {
      while (!bool)
      {
        if (!paramy.e()) {
          break;
        }
        parami.a(paramy.j(), paramk.getInt(paramy.j()));
        paramy.f();
      }
    } while (i != 0);
  }
  
  static int a(d paramd, x paramx, int paramInt)
  {
    int i2 = m.b;
    boolean bool = m.a;
    bb localbb = new bb();
    localbb.add(paramd.e());
    paramx.a(paramd.e(), paramInt);
    localbb.add(paramd.f());
    paramx.a(paramd.f(), -paramInt);
    label190:
    do
    {
      int i;
      a.c.m localm;
      e locale2;
      int i1;
      do
      {
        e locale1;
        do
        {
          if (localbb.isEmpty()) {
            break;
          }
          locale1 = localbb.o();
          i = paramx.getInt(locale1);
          localm = locale1.l();
        } while (!localm.e());
        locale2 = localm.a().a(locale1);
        i1 = paramx.getInt(locale2);
        if (i2 != 0) {
          break label203;
        }
      } while (bool);
      if ((i2 == 0) && (bool)) {
        break label203;
      }
      if (i2 == 0)
      {
        if (i1 == i) {
          break label190;
        }
        if (i2 != 0) {}
      }
      else
      {
        if (i1 == -i) {
          return 1;
        }
        paramx.a(locale2, i);
      }
      localbb.add(locale2);
      localm.f();
    } while (!bool);
    label203:
    return 2;
  }
  
  static void a(d paramd, int paramInt, bb parambb, ab paramab, x paramx)
  {
    int i1 = m.b;
    boolean bool = m.a;
    if (paramd == null) {
      return;
    }
    n localn = db.b();
    bb localbb = new bb();
    localbb.add(paramd.e());
    paramx.a(paramd.e(), 1);
    localbb.add(paramd.f());
    paramx.a(paramd.f(), 1);
    label206:
    do
    {
      int i;
      a.c.m localm;
      d locald;
      e locale2;
      do
      {
        if (localbb.isEmpty()) {
          break;
        }
        e locale1 = localbb.o();
        i = paramx.getInt(locale1);
        do
        {
          parambb.add(locale1);
          localm = locale1.l();
          if (!localm.e()) {
            break;
          }
          locald = localm.a();
          locale2 = locald.a(locale1);
        } while (i1 != 0);
      } while (bool);
      if (i + 1 <= paramInt)
      {
        if (i1 != 0) {
          break label206;
        }
        if (paramx.getInt(locale2) <= 0)
        {
          paramx.a(locale2, i + 1);
          localbb.add(locale2);
        }
      }
      if (i1 == 0)
      {
        if (paramx.getInt(locale2) > 0)
        {
          if (i1 != 0) {
            continue;
          }
          if (!localn.getBool(locald))
          {
            paramab.add(locald);
            localn.a(locald, true);
          }
        }
        localm.f();
      }
    } while (!bool);
  }
  
  mb()
  {
    d(2);
    c(2147483647);
    a(1);
    this.e = new a();
    this.g = u.a();
    this.f = 0;
    this.l = true;
    this.n = false;
    this.m = 1.0D;
  }
  
  void a(double paramDouble)
  {
    int i = m.b;
    boolean bool = m.a;
    if ((i != 0) || (paramDouble >= 0.0D))
    {
      if (i != 0) {
        break label87;
      }
      if (paramDouble <= 1.0D) {}
    }
    else
    {
      throw new IllegalArgumentException("Ratio must be within [0,1]");
    }
    c(true);
    d(2);
    c(2147483647);
    a(4);
    e(0);
    b(false);
    c(1.0D);
    f(2);
    label87:
    if (i == 0) {
      if (paramDouble > 0.84D)
      {
        e(0);
        if ((i == 0) && (!bool)) {
          return;
        }
      }
    }
    if (i == 0) {
      if (paramDouble > 0.69D)
      {
        e(1);
        if ((i == 0) && (!bool)) {
          return;
        }
      }
    }
    if (i == 0)
    {
      if (paramDouble > 0.29D)
      {
        e(1);
        c(4.0D);
        if (i != 0) {
          break label175;
        }
      }
    }
    else if (!bool) {
      return;
    }
    e(2);
    label175:
    f(2);
  }
  
  u a()
  {
    return this.g;
  }
  
  void a(u paramu)
  {
    if (paramu == null) {
      throw new IllegalArgumentException();
    }
    this.g = paramu;
  }
  
  int b()
  {
    return this.h;
  }
  
  void a(int paramInt)
  {
    int i = m.b;
    if (i == 0)
    {
      if (paramInt > 1)
      {
        if (i != 0) {
          break label30;
        }
        this.h = paramInt;
      }
    }
    else if (!m.a) {
      return;
    }
    label30:
    this.h = 2;
  }
  
  void a(boolean paramBoolean)
  {
    this.e.a(paramBoolean);
  }
  
  int c()
  {
    return this.k;
  }
  
  void c(int paramInt)
  {
    int i = m.b;
    if (i == 0)
    {
      if (paramInt > 1)
      {
        if (i != 0) {
          break label31;
        }
        this.k = paramInt;
      }
    }
    else if (!m.a) {
      return;
    }
    label31:
    this.k = 2147483647;
  }
  
  int d()
  {
    return this.j;
  }
  
  void d(int paramInt)
  {
    int i = m.b;
    if (i == 0)
    {
      if (paramInt > 0)
      {
        if (i != 0) {
          break label29;
        }
        this.j = paramInt;
      }
    }
    else if (!m.a) {
      return;
    }
    label29:
    this.j = 1;
  }
  
  int e()
  {
    return this.f;
  }
  
  void e(int paramInt)
  {
    this.f = paramInt;
    this.e.a(paramInt);
  }
  
  double f()
  {
    return this.m;
  }
  
  void c(double paramDouble)
  {
    this.m = paramDouble;
  }
  
  boolean g()
  {
    return this.n;
  }
  
  void b(boolean paramBoolean)
  {
    this.n = paramBoolean;
  }
  
  void f(int paramInt)
  {
    this.e.b(paramInt);
  }
  
  void c(boolean paramBoolean)
  {
    this.l = paramBoolean;
  }
  
  a h()
  {
    return this.e;
  }
  
  String i()
  {
    int i = m.b;
    boolean bool = m.a;
    StringBuffer localStringBuffer = new StringBuffer();
    if (i == 0) {}
    switch (this.f)
    {
    case 0: 
      localStringBuffer.append("default");
      if (i != 0) {
        break label232;
      }
      if (this.n)
      {
        localStringBuffer.append('_').append(this.m);
        if (i != 0) {
          break label232;
        }
        if (!bool) {
          break;
        }
      }
      break;
    case 1: 
      localStringBuffer.append("pivot");
      if (i != 0) {
        break label232;
      }
      if (this.n)
      {
        localStringBuffer.append('_').append(this.m);
        if (i != 0) {
          break label232;
        }
        if (!bool) {
          break;
        }
      }
      break;
    case 2: 
      localStringBuffer.append("local");
      localStringBuffer.append('_').append(this.e.b());
      if (i != 0) {
        break label232;
      }
      if (!bool) {
        break;
      }
    case 3: 
      localStringBuffer.append("random");
      if (i != 0) {
        break label232;
      }
      if (!bool) {
        break;
      }
    default: 
      localStringBuffer.append("no mode");
    }
    localStringBuffer.append(" min:").append(this.j);
    localStringBuffer.append(" max:").append(this.k);
    localStringBuffer.append(" split:").append(this.h);
    label232:
    return localStringBuffer.toString();
  }
  
  int a(q paramq, x paramx)
  {
    int i3 = m.b;
    boolean bool = m.a;
    a.i.y localy = new a.i.y(paramq);
    d[] arrayOfd = paramq.u();
    if (i3 == 0) {
      if (this.f == 2)
      {
        localObject1 = new b_(paramq);
        if ((i3 == 0) && (!bool)) {
          break label98;
        }
      }
    }
    if (this.n)
    {
      if (i3 != 0) {
        break label96;
      }
      localObject1 = new c_(paramq);
      if (!bool) {
        break label98;
      }
    }
    label96:
    Object localObject1 = new a_(paramq);
    label98:
    bb[] arrayOfbb = m.a(paramq);
    int i = 0;
    do
    {
      while (!bool)
      {
        if (i >= arrayOfbb.length) {
          break;
        }
        ((a_)localObject1).a(arrayOfbb[i]);
        i++;
      }
    } while (i3 != 0);
    Object localObject2 = d_.a(paramq, ((a_)localObject1).f(), ((a_)localObject1).e(), this.g.a(arrayOfd, ((a_)localObject1).f(), ((a_)localObject1).e()));
    x localx = db.a(new int[paramq.j()]);
    int i1 = 1;
    while (((a_)localObject1).e() < this.k)
    {
      if (bool) {
        break label417;
      }
      if (((a_)localObject1).d())
      {
        d locald = ((a_)localObject1).c();
        localy.a(locald);
        bb localbb = ((a_)localObject1).a(locald.e());
        int i2 = a(locald, localx, ++i1);
        if (i3 == 0) {
          if (i2 == 1)
          {
            ((a_)localObject1).b(localbb);
            if ((i3 == 0) && (!bool)) {
              continue;
            }
          }
        }
        if (i2 == 2)
        {
          ((a_)localObject1).a(localbb, localx);
          d_ locald_ = d_.a(paramq, ((a_)localObject1).f(), ((a_)localObject1).e(), this.g.a(arrayOfd, ((a_)localObject1).f(), ((a_)localObject1).e()));
          if (i3 == 0) {
            if (locald_.c() != this.j)
            {
              if (i3 == 0) {
                if (locald_.d() <= ((d_)localObject2).d()) {
                  continue;
                }
              }
            }
            else {
              localObject2 = locald_;
            }
          }
          if (!bool) {
            break;
          }
        }
        else
        {
          if (i3 != 0) {
            break label412;
          }
          throw new IllegalStateException("There shouldn't be more than 2 components after an edge removal.");
        }
      }
    }
    a(paramq.v(), ((d_)localObject2).a(), paramx);
    ((a_)localObject1).a();
    localy.i();
    label412:
    label417:
    return ((d_)localObject2).c();
  }
  
  class a_
  {
    private static final double a = 1.7976931348623157E+308D;
    q b;
    n c;
    x d;
    int e;
    ArrayList f;
    private final h g;
    private final n h;
    
    a_(q paramq)
    {
      this.b = paramq;
      this.c = paramq.C();
      this.h = paramq.C();
      this.g = new h(paramq.l(), this.h, this.h);
      this.d = db.a(new int[paramq.j()]);
      this.e = 0;
      this.f = new ArrayList();
    }
    
    void a()
    {
      this.g.g();
      this.b.a(this.c);
      this.b.a(this.h);
      this.b = null;
    }
    
    void a(bb parambb)
    {
      int i = m.b;
      boolean bool = m.a;
      w localw = parambb.l();
      do
      {
        do
        {
          if (!localw.e()) {
            break;
          }
          this.d.a(localw.d(), this.e);
          localw.f();
          if (i != 0) {
            break label87;
          }
          if (bool) {
            break label78;
          }
        } while (!bool);
      } while (i != 0);
      this.f.add(parambb);
      label78:
      if (i == 0)
      {
        label87:
        if (parambb.size() > Math.max(mb.this.h, 1)) {
          mb.this.e.c(this.b, parambb, this.c);
        }
      }
      else
      {
        localw = parambb.l();
        do
        {
          do
          {
            if (!localw.e()) {
              break label203;
            }
            d locald = localw.d().h();
            do
            {
              if (locald == null) {
                break;
              }
              this.g.a(locald, -this.c.getDouble(locald));
              locald = locald.i();
              if (i != 0) {
                break label200;
              }
              if (bool) {
                break label198;
              }
            } while (!bool);
          } while (i != 0);
          localw.f();
        } while (!bool);
      }
      label198:
      label200:
      label203:
      this.e += 1;
    }
    
    bb[] a(bb parambb, x paramx)
    {
      int i1 = m.b;
      boolean bool = m.a;
      int i = 2;
      bb[] arrayOfbb = new bb[i];
      int j = 0;
      do
      {
        do
        {
          if (j >= i) {
            break;
          }
          arrayOfbb[j] = new bb();
          j++;
          if (i1 != 0) {
            break label81;
          }
          if (bool) {
            break label77;
          }
        } while (!bool);
      } while (i1 != 0);
      j = this.d.getInt(parambb.m());
      label77:
      label81:
      int k = this.e;
      w localw = parambb.l();
      do
      {
        do
        {
          if (!localw.e()) {
            break;
          }
          int n = paramx.getInt(localw.d());
          if (bool) {
            break label243;
          }
          if (n > 0)
          {
            arrayOfbb[1].b(localw.d());
            this.d.a(localw.d(), k);
            if (i1 != 0) {
              continue;
            }
            if (!bool) {}
          }
          else
          {
            arrayOfbb[0].b(localw.d());
            this.d.a(localw.d(), j);
          }
          localw.f();
        } while (!bool);
      } while (i1 != 0);
      this.f.add(new bb());
      this.e += 1;
      label243:
      int m = 0;
      do
      {
        while (!bool)
        {
          if (m >= i) {
            break;
          }
          b(arrayOfbb[m]);
          m++;
        }
      } while (i1 != 0);
      return arrayOfbb;
    }
    
    void b(bb parambb)
    {
      int i = m.b;
      if (i == 0)
      {
        this.f.set(this.d.getInt(parambb.m()), parambb);
        if (parambb.size() > Math.max(mb.this.h, 1))
        {
          if (i != 0) {
            break label65;
          }
          c(parambb);
          if (!m.a) {
            return;
          }
        }
      }
      label65:
      d(parambb);
    }
    
    void c(bb parambb)
    {
      int i = m.b;
      boolean bool = m.a;
      mb.this.e.c(this.b, parambb, this.c);
      w localw = parambb.l();
      label93:
      label95:
      do
      {
        do
        {
          if (!localw.e()) {
            return;
          }
          d locald = localw.d().h();
          do
          {
            if (locald == null) {
              break;
            }
            a(locald);
            locald = locald.i();
            if (i != 0) {
              break label95;
            }
            if (bool) {
              break label93;
            }
          } while (!bool);
        } while (i != 0);
        localw.f();
      } while (!bool);
    }
    
    void a(d paramd)
    {
      int i = m.b;
      if (i == 0) {
        if (mb.this.l)
        {
          if (i != 0) {
            break label52;
          }
          if (d(paramd))
          {
            if (i != 0) {
              break label67;
            }
            this.g.d(paramd, 1.7976931348623157E+308D);
            if (!m.a) {
              return;
            }
          }
        }
      }
      label52:
      label67:
      this.g.d(paramd, -this.c.getDouble(paramd));
    }
    
    void d(bb parambb)
    {
      int i = m.b;
      boolean bool = m.a;
      w localw = parambb.l();
      label77:
      label79:
      do
      {
        do
        {
          if (!localw.e()) {
            return;
          }
          d locald = localw.d().h();
          do
          {
            if (locald == null) {
              break;
            }
            this.g.c(locald);
            locald = locald.i();
            if (i != 0) {
              break label79;
            }
            if (bool) {
              break label77;
            }
          } while (!bool);
        } while (i != 0);
        localw.f();
      } while (!bool);
    }
    
    void b(d paramd)
    {
      int i = m.b;
      boolean bool = m.a;
      if (i == 0)
      {
        if (!mb.this.l) {
          return;
        }
        if (i != 0) {}
      }
      else if (paramd.e().c() != 2)
      {
        return;
      }
      a.c.m localm = paramd.e().l();
      do
      {
        if (!localm.e()) {
          break;
        }
        if (i != 0) {
          break label119;
        }
        if (bool) {
          break label118;
        }
        if (!localm.a().equals(paramd)) {
          this.g.d(localm.a(), 1.7976931348623157E+308D);
        }
        localm.f();
      } while (!bool);
      label118:
      if ((i != 0) || (paramd.f().c() == 2))
      {
        label119:
        localm = paramd.f().l();
        do
        {
          if (!localm.e()) {
            break;
          }
          if (i == 0)
          {
            if (!localm.a().equals(paramd)) {
              this.g.d(localm.a(), 1.7976931348623157E+308D);
            }
            localm.f();
          }
        } while (!bool);
      }
    }
    
    d c()
    {
      int i = m.b;
      boolean bool = m.a;
      d locald = (d)this.g.a();
      do
      {
        do
        {
          if (!mb.this.l) {
            break;
          }
          if (bool) {
            break label88;
          }
          if (i == 0)
          {
            if (!d(locald)) {
              break;
            }
            if (i != 0) {
              break label87;
            }
          }
          if (!d()) {
            break;
          }
          this.g.a(locald, 1.7976931348623157E+308D);
          locald = (d)this.g.a();
        } while (!bool);
      } while (i != 0);
      label87:
      label88:
      b(locald);
      return locald;
    }
    
    boolean d()
    {
      int i = m.b;
      if ((i != 0) || (!this.g.d())) {
        if (i != 0) {}
      }
      return this.g.c() < 1.0D;
    }
    
    boolean d(d paramd)
    {
      int i = m.b;
      if (i == 0) {
        if (paramd.e().c() >= 2) {
          if (i != 0) {
            break label35;
          }
        }
      }
      label35:
      return paramd.f().c() < 2;
    }
    
    bb a(e parame)
    {
      return (bb)this.f.get(this.d.getInt(parame));
    }
    
    int e()
    {
      return this.e;
    }
    
    x f()
    {
      return this.d;
    }
    
    h g()
    {
      return this.g;
    }
  }
  
  class c_
    extends mb.a_
  {
    int i = 0;
    final Set j;
    int k;
    
    c_(q paramq)
    {
      super(paramq);
      this.k = ((int)Math.round(Math.sqrt(paramq.l() * mb.this.m)));
      if (m.b == 0)
      {
        if (paramq.l() / this.k < 15.0D) {
          this.k = Math.round(paramq.l() / 15.0F);
        }
        this.j = new HashSet(this.k);
      }
    }
    
    void a()
    {
      this.j.clear();
    }
    
    d c()
    {
      this.i += 1;
      return super.c();
    }
    
    bb[] a(bb parambb, x paramx)
    {
      this.j.remove(parambb);
      return super.a(parambb, paramx);
    }
    
    void b(bb parambb)
    {
      int m = m.b;
      boolean bool = m.a;
      this.f.set(this.d.getInt(parambb.m()), parambb);
      if (m == 0) {
        if (parambb.size() > Math.max(mb.this.h, 1))
        {
          this.j.add(parambb);
          if ((m == 0) && (this.i < this.k)) {
            return;
          }
          Iterator localIterator = this.j.iterator();
          do
          {
            if (!localIterator.hasNext()) {
              break;
            }
            c((bb)localIterator.next());
            if (m != 0) {
              break label146;
            }
            if (bool) {
              break label145;
            }
          } while (!bool);
          this.i = 0;
          if (m != 0) {
            break label158;
          }
          this.j.clear();
          label145:
          label146:
          if ((m == 0) && (!bool)) {
            return;
          }
        }
      }
      label158:
      this.j.remove(parambb);
      d(parambb);
    }
  }
  
  class b_
    extends mb.a_
  {
    final bb i;
    final ab j;
    x k;
    final n l;
    
    b_(q paramq)
    {
      super(paramq);
      this.l = paramq.C();
      this.i = new bb();
      this.j = new ab();
    }
    
    void a()
    {
      this.b.a(this.l);
      this.i.clear();
      this.j.clear();
      this.k = null;
      super.a();
    }
    
    bb[] a(bb parambb, x paramx)
    {
      int m = m.b;
      boolean bool = m.a;
      mb.this.e.a(this.b, parambb, this.k, this.l);
      mb.a(this.j.l(), this.c, this.l);
      do
      {
        a.c.m localm = this.j.l();
        while (!bool)
        {
          if (!localm.e()) {
            break;
          }
          if (bool) {
            break label100;
          }
          super.a(localm.a());
          localm.f();
        }
      } while (m != 0);
      label100:
      return super.a(parambb, paramx);
    }
    
    void c(bb parambb) {}
    
    d c()
    {
      d locald = super.c();
      this.i.clear();
      this.j.clear();
      this.k = db.a(new int[this.b.j()]);
      mb.a(locald, mb.this.e.b(), this.i, this.j, this.k);
      mb.this.e.a(this.b, this.i, this.k, this.l);
      mb.b(this.j.l(), this.c, this.l);
      this.j.remove(locald);
      return locald;
    }
  }
  
  static class d_
  {
    private final q a;
    private final x c;
    private final int d;
    private final double e;
    
    static d_ a(q paramq, x paramx, int paramInt, double paramDouble)
    {
      x localx = db.a(new int[paramq.j()]);
      mb.a(paramq.v(), paramx, localx);
      return new d_(paramq, localx, paramInt, paramDouble);
    }
    
    private d_(q paramq, x paramx, int paramInt, double paramDouble)
    {
      this.a = paramq;
      this.c = paramx;
      this.d = paramInt;
      this.e = paramDouble;
    }
    
    x a()
    {
      return this.c;
    }
    
    int c()
    {
      return this.d;
    }
    
    double d()
    {
      return this.e;
    }
    
    q e()
    {
      return this.a;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.a.mb

 * JD-Core Version:    0.7.0.1

 */